<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>儿子1</li>
        <li>儿子2</li>
        <li>儿子3</li>
        <li>儿子4</li>
    </ul>
    <script>
        var ul = document.querySelector("ul")
        var li3 = document.querySelector("li:nth-child(3)")
        //在ul里面添加一个新的儿子,叫做文雯
        //创建一个li标签
        var li = document.createElement("li")
        //给这个li添加一个文本值
        li.innerHTML = "文雯"
        //追加到爹的里面去
        // ul.appendChild(li)

        ul.insertBefore(li,li3)
    </script>
</body>
</html>